package com.tanhua.dubbo.server.api;

import com.alibaba.dubbo.config.annotation.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.domain.db.Question;
import com.tanhua.domain.db.Settings;
import com.tanhua.dubbo.server.mapper.QuestionMapper;
import org.springframework.beans.factory.annotation.Autowired;


@Service
public class QuestionServiceImpl implements QuestionApi {

    @Autowired
    private QuestionMapper questionMapper;

    public Question queryQuestion(Long userId) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("user_id", userId);
        return this.questionMapper.selectOne(queryWrapper);
    }

    @Override
    public void save(Question question) {
        this.questionMapper.insert(question);
    }

    @Override
    public void update(Question question) {
        this.questionMapper.updateById(question);
    }
}
